<?php
/**
 * Dev.php 20 July 2009
 * @author Kevin Breed
 *
 * This class specifies how the paths in the dev environment are composed. See 
 * the functions for the specific compositions.
 */

require_once( 'KB/Bootstrap/Environment/Abstract.php' );
 
class KB_Bootstrap_Environment_Dev extends KB_Bootstrap_Environment_Abstract
{					
	
	/**
	 * Definition of the projectDirName by searching the name of the 
	 * 'parent parent' directory of the executing script
	 */
	protected function _initProjectDirName ()
	{
		$dirNames = split( '/', dirname( $_SERVER[ 'SCRIPT_FILENAME' ] ) );
		
		$this->_projectDirName = $dirNames[ count( $dirNames ) - 2 ];
	}
	
	/**
	 * Composition of the appPath as 'docRoot/projectDirName/applicationDirName'
	 */
	protected function _composeAppPath () 
	{
		$this->_appPath 		= $this->docRoot
								. "$this->projectDirName/" 
								. $this->applicationDirName;
		$this->_appPathSetFlag 	= false;	
	}
	
	/**
	 * Composition of the appConfigPath as 'appPath/configDirName'
	 */
	protected function _composeAppConfigPath () 
	{
		$this->_appConfigPath 			= "$this->_appPath/" 
										. $this->configDirName; 
		$this->_appConfigPathSetFlag 	= false;
	}
	
	
	/**
	 * A definition of the dependencies between parts and paths. This means that 
	 * if part x is changed, the paths listed as value should also change.
	 */		
	protected function _initPartToPathsDependencies ()
	{
		$this->partToPathsDependencies = array
		(			
			'projectDirName'
				=> array
				(
					'appPath'
				),
		
			'applicationDirName'
				=> array
				(
					'appPath'
				),
			
			'configDirName'
				=> array
				(
					'appConfigPath'
				)
		);
	}
	
	/**
	 * A definition of the dependencies between paths. This means that if path x 
	 * is changed the paths listed as value should also changes.
	 */
	protected function _initPathToPathsDependencies ()
	{
		$this->pathToPathsDependencies = array
		(			
			'appPath' 
				=> array
				(
					'appConfigPath'
				)
		);
	}
}

?>
